﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using 垃圾小游戏.class4;
using 垃圾小游戏.class3;
using 垃圾小游戏.class1;

namespace 垃圾小游戏.class5
{
    internal class Map : IDraw
    {
        public Wall[] walls;//墙的数组
        public Map()
        {
            walls = new Wall[Game.w + (Game.h - 3)*2];//绘制多少个墙体
            int index = 0;//记录墙体数量
            //绘制墙体（高）
            for (int i = 0; i < Game.w; i += 2)
            {
                walls[index] = new Wall(i,0);//横向上排
                ++index;
            }
            for (int i = 0; i < Game.w; i += 2)
            {
                walls[index] = new Wall(i, Game.h - 2);//横向上排
                ++index;
            }
            for(int i = 1;i < Game.h - 2;i++)
            {
                walls[index] = new Wall(0,i);
                ++index;
            }
            for (int i = 1; i < Game.h - 2; i++)
            {
                walls[index] = new Wall(Game.w - 2, i);
                ++index;
            }
        }
        public void Draw()
        {
            for (int i = 0;i < walls.Length; i++)
            {
                walls[i].Draw();
            }
        }
    }
}
